$(function(){
	login();
	function login() {
		var loginViewStr="<center>"+
		"<img src='img/logo.png'><br>"+
		"<table border='0'>"+
			"<tr>"+
				"<td><input type='text' id='id' placeholder='아이디' width='100'><br>"+
				"<input type='password' id='password' placeholder='패스워드' width='100'></td>"+
				"<td><input type='button' style='height: 50px; width: 70px' value='로그인' id='login'></input></td>"+
			"</tr>"+
		"</table>"+
		"</center>";
		$("#main").html(loginViewStr);
	}
	
	production_state();
	function production_state(){
		$.ajax({
			type : "POST",
			url : "login.do",
			data : "command=production_stateView",
			dataType : "json", 
			success : function(jsonData) {
				production_state = jsonData.production_state;
				if(production_state=='start'){
					$("#footer").html("<img src='img/start.gif'>");
				}else{
					$("#footer").html("<img src='img/stop.gif'>");
				}
			}
		});
	}
	
	$("#main").on("click","#login",function(){
		var id=$("#id").val();
		var pass=$("#password").val();
		$.ajax({
			type : "POST",
			url : "login.do",
			data : "command=login&member_id="+id+"&member_password="+pass,
			dataType : "json",
			success : function(jsonData){
				var member_id=jsonData.mvo.member_id;
				if(member_id=="master"){
					operatorView();
				}else if(member_id=="manager"){
					managerView();
				}
			}
		});
	});		
});

